using namespace std;
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>

vector<int> twoSum(vector<int> &numbers, int target) {
    map<int, int> num_map;
    int c = (sizeof(numbers) / sizeof(int));
    for(int i = 0; i < c; i++) {
        num_map[numbers[i]] = i;
    }

    sort(numbers.begin(), numbers.end());

    int j = 0;
    int k = c - 1;

    while(numbers[j] + numbers[k] != target) {
        if(j == k) {
            vector<int> res(-1,2);
            return res;
        }
        int sum = numbers[j] + numbers[k];
        if(sum > target) {
            ++k;
        } else {
            ++j;
        }
    }

    int index1 = num_map.find(numbers[j])->second;
    int index2 = num_map.find(numbers[k])->second;
    
    vector<int> res;
    if(index1 < index2) {
        res.push_back(index1);
        res.push_back(index2);
    } else {
        res.push_back(index1);
        res.push_back(index2);
    }
    return res;
}

int main()
{
    int input[]= {1,3,10,30,5,7};
    cout << sizeof(input);
    vector<int> tmp(input, input + (sizeof(input)/sizeof(int)));
    vector<int> res = twoSum(tmp, 4);
    cout << res[0];
    cout << res[1];
}
